package com.lm.activiti.boot.cases.dto;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.springframework.stereotype.Component;

import javax.validation.constraints.NotBlank;

/**
 * @author lm_jcf
 * @date 2018/11/9 14:11
 */
public class ParentProperties<T> implements Comparable<ParentProperties>{

    private Integer id;

    @NotBlank(message = "姓名不能为空")
    private String name;

    private int age;

    private T t;

    private Object object;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public T getT() {
        return t;
    }

    public void setT(T t) {
        this.t = t;
    }

    public Object getObject() {
        return object;
    }

    public void setObject(Object object) {
        this.object = object;
    }

    @Override
    public String toString() {
        return "ParentProperties{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", age=" + age +
                ", t=" + t +
                ", object=" + object +
                '}';
    }

    @Override
    public int compareTo(ParentProperties o) {
//        return this.getAge() - o.getAge();
        return 1;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;

        if (o == null || getClass() != o.getClass()) return false;

        ParentProperties<?> that = (ParentProperties<?>) o;

        return new EqualsBuilder()
                .append(id, that.id)
                .append(name, that.name)
                .append(age, that.age)
                .append(t, that.t)
                .append(object, that.object)
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .append(id)
                .append(name)
                .append(age)
                .append(t)
                .append(object)
                .toHashCode();
    }
}
